home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / external / rpc / idl_rpc_test.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-08  |  31.3 KB  |  1,092 lines

  1. /*
  2.  *  rpctest.c
  3.  *
  4.  *  $Id: idl_rpc_test.c,v 1.4 1997/01/29 23:28:17 kirk Exp $
  5.  *  
  6.  *
  7.  *
  8.   Copyright (c) 1988-1997, Research Systems Inc.  All rights reserved.
  9.   This software includes information which is proprietary to and a
  10.   trade secret of Research Systems, Inc.  It is not to be disclosed
  11.   to anyone outside of this organization. Reproduction by any means
  12.   whatsoever is  prohibited without express written permission.
  13.  */
  14.  
  15.  
  16.  
  17. /*
  18.  * Purpose:
  19.  *     This file contains routines that test the idl rpc client
  20.  *    API.
  21.  */
  22.  
  23. #include "idl_rpc.h"
  24.  
  25. /*
  26.  * Static variable used to signal that the memory callback is called
  27.  */
  28. static int iCBFlag=0;
  29.  
  30. /*
  31.  * Prototypes
  32.  */
  33. IDL_ARRAY_FREE_CB RPCArrCBTest(UCHAR *pData);
  34. int RPCVarTest(void);
  35. int RPCStringTest(void);
  36. int RPCScalarTest(CLIENT *pClient);
  37. int RPCGetArrayTest(CLIENT *pClient);
  38. int RPCSetArrayTest(CLIENT *pClient);
  39. int RPCMemoryTest(CLIENT *pClient);
  40. int RPCExeTest(CLIENT *pClient);
  41. void RPCFlushOutput(CLIENT *pClient);
  42.  
  43. /****************************************************************************
  44.  *   main
  45.  *
  46.  *   PURPOSE:
  47.  *        This is the main program for the idl_rpc_test IDL rpc client program.
  48.  *        This program accepts the following command line arguments.
  49.  *
  50.  *            % idl_rpc_test <server_id> 
  51.  *            % idl_rpc_test <hostname>
  52.  *            % idl_rpc_test <server_id> <hostname>
  53.  *
  54.  *        Where  the server_id is the rpc id for the rpc server and the
  55.  *        hostname is the name of the host that is running the rpc server.
  56.  */
  57. int main(c,v)
  58.     int    c;
  59.     char **v;
  60. {
  61.    CLIENT    *pClient;
  62.    char        cmdbuffer[ IDL_RPC_MAX_STRLEN ];
  63.    IDL_LONG    server_id     = 0;
  64.    char        * hostname    = NULL;
  65.    int      result,i;
  66.    IDL_VPTR       vTmp;
  67.    float        *pData;
  68.  
  69. /* 
  70.  * Process the command line arguments. If there are two arguments
  71.  * then the first must be the server ID and the second must be the
  72.  * server ID.
  73.  */
  74.    switch(c){
  75.    case 3:
  76.      sscanf( v[1], "0x%x", &server_id );
  77.      hostname = v[2];
  78.      break;     
  79.    case 2:    
  80.      if( !strncmp( v[1], "0x", 2 ) ) 
  81.        sscanf( v[1], "0x%x", &server_id );
  82.      else hostname = v[1];
  83.      break;
  84.    default:
  85.      break; 
  86.    }
  87. /*
  88.  * Register the client, check for errors
  89.  */      
  90.    if( (pClient = IDL_RPCInit( server_id, hostname)) ==NULL){
  91.      printf("Can't register with server on \"%s\"\n",
  92.            hostname ? hostname : "localhost");
  93.      exit(1);
  94.    }
  95. /*
  96.  * Reset the timeout to 2 minutes
  97.  */
  98.    if(!IDL_RPCTimeout(120)){
  99.        printf("Unable to set timeout\n");
  100.        exit(1);
  101.    }
  102. /*
  103.  * Now should be connected to server. Perform Variable tests
  104.  */
  105.    fprintf(stdout, "Variable Tests\t\t");
  106.    if(RPCVarTest() != 0){    /* Had an error */
  107.       fprintf(stderr, "FAILED\n");
  108.       IDL_RPCCleanup(pClient, 0);
  109.       exit(1);
  110.    }
  111.    fprintf(stdout, "PASSED\n");
  112.    fprintf(stdout, "String Tests\t\t");
  113.    if(RPCStringTest() != 0){
  114.       fprintf(stderr, "FAILED\n");
  115.       IDL_RPCCleanup(pClient, 0);
  116.       exit(1);
  117.    }
  118.    fprintf(stdout, "PASSED\n");
  119. /*
  120.  * Now to perform tests with scalar variables
  121.  */
  122.    fprintf(stdout, "Scalar Tests\t\t");
  123.    if(RPCScalarTest(pClient) != 0){  /* Had an error */
  124.       fprintf(stderr, "FAILED\n");
  125.       IDL_RPCCleanup(pClient, 0);  
  126.       exit(1);
  127.    } 
  128.    fprintf(stdout, "PASSED\n");
  129. /*
  130.  * Now array tests
  131.  */
  132.    fprintf(stdout, "Get Array Tests\t\t");
  133.    if(RPCGetArrayTest(pClient) != 0){   /* Had an error */
  134.       fprintf(stderr, "FAILED\n");
  135.       IDL_RPCCleanup(pClient, 0);
  136.       exit(1);
  137.    } 
  138.    fprintf(stdout, "PASSED\n");
  139.    fprintf(stdout, "Set Array Tests\t\t");
  140.    if(RPCSetArrayTest(pClient) != 0){   /* Had an error */
  141.       fprintf(stderr, "FAILED\n");
  142.       IDL_RPCCleanup(pClient, 0);
  143.       exit(1);
  144.    } 
  145.    fprintf(stdout, "PASSED\n");
  146. /*
  147.  * Check for server memory leaks
  148.  */
  149.    fprintf(stdout, "Server Memory Tests\t");
  150.    if(RPCMemoryTest(pClient) != 0){
  151.       fprintf(stderr, "FAILED\n");
  152.       IDL_RPCCleanup(pClient, 0);
  153.       exit(1);
  154.    }
  155.    fprintf(stdout, "\tPASSED\n");
  156. /* 
  157.  * Finally, Output Redirection and execute command tests 
  158.  */
  159.    if(RPCExeTest(pClient) != 0){
  160.       fprintf(stderr, "FAILED\n");
  161.       IDL_RPCCleanup(pClient, 0);
  162.       exit(1);
  163.    } 
  164.    fprintf(stdout, "IDL Execute String\tPASSED\n");
  165. /*
  166.  * If we are at this point all of the data and interaction tests worked.
  167.  * Now test the different options of IDL Cleanup. First dissconnect
  168.  * the client and leave the server running.
  169.  */
  170.    fprintf(stdout, "IDL_RPCCleanup Tests\t");
  171.    if(IDL_RPCCleanup(pClient, 0) != 1){
  172.       fprintf(stderr, "FAILED\n");
  173.       fprintf(stderr, "Error disconnecting client\n");
  174.       exit(1);
  175.    }
  176. /*
  177.  * Now reconnect to the server and then disconnect, killing the server
  178.  */
  179.    if( (pClient = IDL_RPCInit( server_id, hostname)) == NULL)
  180.    {
  181.      fprintf(stderr, "Can't register with server on \"%s\"\n",
  182.            hostname ? hostname : "localhost");
  183.      fprintf(stderr, 
  184.     "Possible error with IDL_RPCCleanup when disconnecting client\n");
  185.      exit(1);
  186.    }
  187. /*
  188.  * Now to kill the server and the client
  189.  */
  190.    if(IDL_RPCCleanup(pClient, 1) != 1){
  191.       fprintf(stderr, "Error killing server and disconnecting client\n");
  192.       exit(1);
  193.    }
  194.    fprintf(stdout, "PASSED\n");
  195. /*
  196.  * If we got this far, all tests passed. Indicate this and exit
  197.  */
  198.    printf("\nAll RPC tests\t\tPASSED\n");
  199.    exit(0);
  200. }
  201. /**********************************************************************
  202.  */
  203. IDL_ARRAY_FREE_CB RPCArrCBTest(UCHAR *pData)
  204. {
  205.    iCBFlag = 0;
  206.    free(pData);
  207. }
  208. /***********************************************************************
  209.  * RPCVarTest()
  210.  *
  211.  * Purpose:
  212.  *     This function is used to test the behavior of the IDL
  213.  *    RPC client variable manipulation API. Basically this
  214.  *    routine will create and destroy local variables making
  215.  *    sure that flags and memory are handled correctly.
  216.  */
  217. int RPCVarTest(void)
  218. {
  219.    IDL_VPTR     pVar1;
  220.    IDL_VPTR    pVar2;
  221.    IDL_VARIABLE Var1_s;
  222.    UCHAR         *pData1, *pData2;
  223.    char         *pStr;
  224.  
  225.    IDL_LONG     lDim[2] = {10,10};
  226.  
  227.    bzero((char*)&Var1_s, sizeof(IDL_VARIABLE)); /* clear stack crap */
  228.  
  229. /*
  230.  * Create and destroy a simple variable
  231.  */
  232.    if( (pVar1 = IDL_RPCGettmp()) == (IDL_VPTR)NULL){
  233.        fprintf(stderr, "IDL_RPCGettmp: Error allocating variable\n");
  234.        return 1;
  235.    }
  236. /*
  237.  * Make sure that the flags section is marked as IDL_V_TEMP and that
  238.  * the type is 0.
  239.  */
  240.    if( !(pVar1->flags & IDL_V_TEMP)){
  241.       fprintf(stderr, "IDL_RPCGettmp: IDL_V_TEMP flag not set.\n");
  242.       return 1;
  243.    }
  244.    if(pVar1->type){
  245.       fprintf(stderr, "IDL_RPCGettmp: type field not set to null.\n");
  246.       return 1;
  247.    }
  248.    if( pVar1->flags & ~IDL_V_TEMP){
  249.      fprintf(stderr, "IDL_RPCGettmp: flags field incorrect\n");
  250.      return 1;
  251.    }
  252. /*
  253.  * Gettmp pass it's simple tests, now to deltmp the variable. Not
  254.  * Much you can test except that the OS doesnt give you an error.
  255.  */
  256.    IDL_RPCDeltmp(pVar1);   
  257. /*
  258.  * Create an array.
  259.  */
  260.    if( (pData1 = (UCHAR*)IDL_RPCMakeArray(IDL_TYP_LONG, 2, lDim, 0, 
  261.                   &pVar1)) == (UCHAR*)NULL) {
  262.    /*
  263.     *  Had an error in creating the array
  264.     */
  265.        fprintf(stderr, "IDL_RPCMakeArray: Null value returned\n");
  266.        return 1;
  267.     }
  268. /*
  269.  * Create a temporary variable and copy the array data to it. Then
  270.  * test to make sure the variable copied correctly.
  271.  */
  272.    if( (pVar2 = IDL_RPCGettmp()) == NULL){
  273.       IDL_RPCDeltmp(pVar1);
  274.       fprintf(stderr, "IDL_RPCGettmp: Error getting variable\n");
  275.       return 1;
  276.    }
  277. /*
  278.  * Do a var copy on the array and make sure that the correct behavoir
  279.  * occurs.
  280.  */
  281.    IDL_RPCVarCopy(pVar1, pVar2);
  282.  
  283. /*
  284.  * Check the source variable. It should be an undefined variable with
  285.  * the TEMP flag set.
  286.  */
  287.    if(pVar1->type != (UCHAR)0){
  288.       fprintf(stderr, "IDL_RPCVarCopy: source variable type incorrect\n");
  289.       return 1;
  290.    }
  291.    if(!(pVar1->flags & IDL_V_TEMP)){
  292.       fprintf(stderr, "IDL_RPCVarCopy: source temp flag not preserved\n");
  293.       return 1;
  294.    }
  295.    if( pVar1->flags & ~IDL_V_TEMP){
  296.        fprintf(stderr, "IDL_RPCVarCopy: source flags incorrect\n");
  297.        return 1;
  298.    }
  299.    if(IDL_RPCVarIsArray(pVar1)){    /* source should be undefined */
  300.       fprintf(stderr, "IDL_RPCVarCopy: source variable not zeroed\n");
  301.       return 1;
  302.    }
  303. /* 
  304.  * Now for the dest. variable
  305.  */
  306.    if(!IDL_RPCVarIsArray(pVar2)){ /* dest should now be an array */
  307.      fprintf(stderr, "IDL_RPCVarCopy: Array was not copied correctly\n");
  308.      return 1;
  309.    }
  310.    if(IDL_RPCGetArrayData(pVar2) != pData1){
  311.       fprintf(stderr, "IDL_RPCVarCopy: Array Data block not moved\n");
  312.       return 1;
  313.    }
  314.    if(IDL_RPCGetArrayNumDims(pVar2) != 2){
  315.       fprintf(stderr, "IDL_RPCVarCopy: Dest. array dims incorrect.\n");
  316.       return 1;
  317.    }
  318.    IDL_RPCDeltmp(pVar1);  /* free up variable */
  319. /*
  320.  * Now copy the information over to a static variable. This will be 
  321.  * used to verify var copy will allocate space for data when the source
  322.  * variable is not marked *temp*.
  323.  */ 
  324.    IDL_RPCVarCopy(pVar2, &Var1_s);
  325. /*
  326.  * pVar2 should now be *undefined*. Check this.
  327.  */
  328.    if(pVar2->type != (UCHAR)NULL || !(pVar2->flags & IDL_V_TEMP)){
  329.       fprintf(stderr, "IDL_RPCVarCopy: error with copy to static var.\n");
  330.       return 1;
  331.    }
  332.    IDL_RPCVarCopy( &Var1_s, pVar2); /* should allocate new memory */
  333.  
  334.    if(!IDL_RPCVarIsArray(&Var1_s)){
  335.       fprintf(stderr, "IDL_RPCVarCopy: error with copy to static var.\n");
  336.       return 1;
  337.    }
  338.    if(IDL_RPCGetArrayData(pVar2) == IDL_RPCGetArrayData(&Var1_s)){
  339.    /*
  340.     * The data pointers should be different. Signal an error
  341.     */
  342.       fprintf(stderr, "IDL_RPCVarCopy: static copy, data was moved\n");
  343.       return 1;
  344.    }
  345. /*
  346.  * Make sure that the dest variable didnt get the tmp bit set
  347.  */
  348.    if(Var1_s.flags & IDL_V_TEMP){
  349.       fprintf(stderr, "IDL_RPCVarCopy: static variable had TEMP bit set\n");
  350.       return 1;
  351.    }
  352. /* 
  353.  * Now free the array and all variables that are in use
  354.  */
  355.    IDL_RPCDeltmp(pVar2);
  356.    IDL_RPCDeltmp(&Var1_s);
  357.  
  358. /* 
  359.  * Now for the last test, Lets import an array.
  360.  */
  361.    pData1 = (UCHAR*)malloc((unsigned)sizeof(IDL_LONG)*100);
  362.    if(!pData1){
  363.       perror("malloc");
  364.       return 1;
  365.    }
  366.    pVar1 = IDL_RPCImportArray(2, lDim, IDL_TYP_LONG, pData1, 
  367.                   (IDL_ARRAY_FREE_CB)RPCArrCBTest);
  368.    if(!pVar1){
  369.       fprintf(stderr, "IDL_RPCImportArray: error detected\n");
  370.       free(pData1);
  371.       return 1;
  372.    }
  373. /*
  374.  * Do a quick array check
  375.  */
  376.    if( !IDL_RPCVarIsArray(pVar1)){
  377.       fprintf(stderr, "IDL_RPCImportArray: Array flag not set\n");
  378.       free(pData1);
  379.       return 1;
  380.    }
  381.    if( IDL_RPCGetArrayNumDims(pVar1) != 2){
  382.       fprintf(stderr, "IDL_RPCImportArray: n dims incorrect\n");
  383.       free(pData1);
  384.       return 1;
  385.    }
  386.    if( IDL_RPCGetArrayData(pVar1) != pData1){
  387.       fprintf(stderr, "IDL_RPCImportArray: Data pointer incorrect.\n");
  388.       free(pData1);
  389.       return 1;
  390.    }
  391. /*
  392.  * Now free the data. This should call the callback func.
  393.  */
  394.    iCBFlag =1;  /* should be set to 0 by the callback function */
  395.    IDL_RPCDeltmp(pVar1);
  396.    if(iCBFlag){
  397.       fprintf(stderr, "IDL_RPCDeltmp: Error in calling memory callback.\n");
  398.       return 1;
  399.    }
  400.   
  401.    return 0;
  402. }                     
  403. /*************************************************************************
  404.  * RPCStringTest()
  405.  *
  406.  * Purpose:
  407.  *    This routine test the string functions which are part of the 
  408.  *     API.
  409.  */
  410. int RPCStringTest(void)
  411. {
  412.    IDL_STRING  IDLStr_s;
  413.    IDL_ALLTYPES  Scalar_s;
  414.    char     * pCStr;
  415.  
  416.    bzero((char*)&IDLStr_s, sizeof(IDL_STRING));
  417. /*
  418.  * Store the value of a string in the alltypes union
  419.  */
  420.    IDL_RPCStrStore(&IDLStr_s, "testing");
  421.  
  422.    if(IDLStr_s.slen != 7){
  423.       fprintf(stderr, "IDL_RPCStrStore: String Length incorrect.\n");
  424.       return 1;
  425.    }
  426.    pCStr = IDLStr_s.s;   /* get the pointer to the string */
  427. /* 
  428.  * Dup the string and make sure the poniters change
  429.  */
  430.    IDL_RPCStrDup( &IDLStr_s, 1L);
  431.    if(IDLStr_s.s == pCStr){
  432.       fprintf(stderr, "IDL_RPCStrDup: string not duplicated.\n");
  433.       return 1;
  434.    }
  435. /*
  436.  * Delete the string and make sure the struct is cleared.
  437.  */
  438.    IDL_RPCStrDelete(&IDLStr_s, 1L);
  439.    if(IDLStr_s.slen != 0 || IDLStr_s.stype != 0){
  440.       fprintf(stderr, "IDL_RPCStrDelete: String sturct not cleared.\n");
  441.       return 1;
  442.    }
  443. /*
  444.  * And now for ensure length
  445.  */
  446.    IDL_RPCStrEnsureLength(&IDLStr_s, 23);
  447.    if(IDLStr_s.slen != 23){
  448.       fprintf(stderr, "IDL_RPCStrEnsureLength: slen not set correctly.\n");
  449.       return 1;
  450.    }
  451.    IDL_RPCStrDelete(&IDLStr_s, 1L);
  452. /*
  453.  * Thats it for the string test
  454.  */
  455.  
  456.    return 0;
  457. }
  458. /***************************************************************************
  459.  * RpcScalarTest() 
  460.  * 
  461.  * Used to test the scalar ops available via IDL rpc's
  462.  */
  463. int RPCScalarTest(CLIENT *client)
  464. {
  465.    IDL_VPTR   vPtr, vTmp;
  466.    IDL_ALLTYPES type_s;
  467.    IDL_RPC_LINE_S sLine;
  468.    int status;
  469.  
  470.    vPtr = IDL_RPCGettmp();  
  471. /*
  472.  * Set the values of the scalar and send to the RPC server
  473.  */
  474.    type_s.c = (UCHAR)1;
  475.    IDL_RPCStoreScalar(vPtr, IDL_TYP_BYTE, &type_s);
  476.    if(!IDL_RPCSetMainVariable(client, "V_BYTE", vPtr)){
  477.       fprintf(stderr, "error setting variable in server: byte");
  478.       IDL_RPCDeltmp(vPtr);
  479.       return 1;
  480.    }
  481.  
  482.    vTmp = IDL_RPCGetMainVariable(client, "V_BYTE");
  483.    if(vTmp->type != IDL_TYP_BYTE || vTmp->value.c != (UCHAR)1){
  484.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting variable\n");
  485.        return 1;
  486.    }
  487.    IDL_RPCDeltmp(vTmp);
  488.  
  489.    type_s.i = 2;
  490.    IDL_RPCStoreScalar(vPtr, IDL_TYP_INT, &type_s);
  491.    if(!IDL_RPCSetMainVariable(client, "V_INT", vPtr)){
  492.       fprintf(stderr, "error setting variable in server: int");
  493.       IDL_RPCDeltmp(vPtr);
  494.       return 1;
  495.    }
  496.    vTmp = IDL_RPCGetMainVariable(client, "V_INT");
  497.    if(vTmp->type != IDL_TYP_INT || vTmp->value.i != 2){
  498.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting variable\n");
  499.        return 1;
  500.    }
  501.    IDL_RPCDeltmp(vTmp);
  502.  
  503.    type_s.l = 3L;
  504.    IDL_RPCStoreScalar(vPtr, IDL_TYP_LONG, &type_s);
  505.    if(!IDL_RPCSetMainVariable(client, "V_LONG", vPtr)){
  506.       fprintf(stderr,"error setting variable in server: long");
  507.       IDL_RPCDeltmp(vPtr);
  508.       return 1;
  509.    }
  510.    vTmp = IDL_RPCGetMainVariable(client, "V_LONG");
  511.    if(vTmp->type != IDL_TYP_LONG || vTmp->value.l != 3L){
  512.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting variable\n");
  513.        return 1;
  514.    }
  515.    IDL_RPCDeltmp(vTmp);
  516.  
  517.    type_s.f = 4.0f;
  518.    IDL_RPCStoreScalar(vPtr, IDL_TYP_FLOAT, &type_s);
  519.    if(!IDL_RPCSetMainVariable(client, "V_FLOAT", vPtr)){
  520.       fprintf(stderr,"error setting variable in server: float");
  521.       IDL_RPCDeltmp(vPtr);
  522.       return 1;
  523.    }
  524.    vTmp = IDL_RPCGetMainVariable(client, "V_FLOAT");
  525.    if(vTmp->type != IDL_TYP_FLOAT || vTmp->value.f != 4.0f){
  526.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting variable\n");
  527.        return 1;
  528.    }
  529.    IDL_RPCDeltmp(vTmp);
  530.  
  531.    type_s.d = 5.0;
  532.    IDL_RPCStoreScalar(vPtr, IDL_TYP_DOUBLE, &type_s);
  533.    if(!IDL_RPCSetMainVariable(client, "V_DOUBLE", vPtr)){
  534.       fprintf(stderr,"error setting variable in server: double");
  535.       IDL_RPCDeltmp(vPtr);
  536.       return 1;
  537.    }
  538.  
  539.    vTmp = IDL_RPCGetMainVariable(client, "V_DOUBLE");
  540.    if(vTmp->type != IDL_TYP_DOUBLE || vTmp->value.d != 5.0){
  541.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting variable\n");
  542.        return 1;
  543.    }
  544.  
  545.    IDL_RPCDeltmp(vTmp);
  546.    type_s.cmp.r = 6.0f;
  547.    type_s.cmp.i = 7.0f;
  548.    IDL_RPCStoreScalar(vPtr, IDL_TYP_COMPLEX, &type_s);
  549.    if(!IDL_RPCSetMainVariable(client, "V_COMPLEX", vPtr)){
  550.       fprintf(stderr,"error setting variable in server: complex");
  551.       IDL_RPCDeltmp(vPtr);
  552.       return 1;
  553.    }
  554.    vTmp = IDL_RPCGetMainVariable(client, "V_COMPLEX");
  555.    if(vTmp->type != IDL_TYP_COMPLEX || vTmp->value.cmp.r != 6.0f ||
  556.     vTmp->value.cmp.i != 7.0f){
  557.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting variable\n");
  558.        return 1;
  559.    }
  560.    IDL_RPCDeltmp(vTmp);
  561.  
  562.    type_s.dcmp.r = 8.0;
  563.    type_s.dcmp.i = 9.0;
  564.    IDL_RPCStoreScalar(vPtr, IDL_TYP_DCOMPLEX, &type_s);
  565.    if(!IDL_RPCSetMainVariable(client, "V_DCOMPLEX", vPtr)){
  566.       printf("error setting variable in server: double complex");
  567.       IDL_RPCDeltmp(vPtr);
  568.       return 1;
  569.    }
  570.    vTmp = IDL_RPCGetMainVariable(client, "V_DCOMPLEX");
  571.    if(vTmp->type != IDL_TYP_DCOMPLEX || vTmp->value.dcmp.r != 8.0 ||
  572.     vTmp->value.dcmp.i != 9.0){
  573.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting variable\n");
  574.        return 1;
  575.    }
  576.    IDL_RPCDeltmp(vTmp);
  577.  
  578.    IDL_RPCStrStore(&type_s.str, "TEN");    /* test string functions also */
  579.    IDL_RPCStoreScalar(vPtr, IDL_TYP_STRING, &type_s); /* copies string */
  580.    IDL_RPCStrDelete(&type_s.str, 1L);
  581.    if(!IDL_RPCSetMainVariable(client, "V_STRING", vPtr)){
  582.       fprintf(stderr,"error setting variable in server: string ");
  583.       IDL_RPCDeltmp(vPtr);
  584.       return 1;
  585.    }
  586.    vTmp = IDL_RPCGetMainVariable(client, "V_STRING");
  587.    if(vTmp->type != IDL_TYP_STRING || strcmp(vPtr->value.str.s, 
  588.         vTmp->value.str.s)){
  589.        fprintf(stderr, "IDL_RPCGetMainVariable: Error getting variable\n");
  590.        return 1;
  591.    }
  592.    IDL_RPCDeltmp(vTmp);
  593.    IDL_RPCDeltmp(vPtr);
  594.  
  595.    if(IDL_RPCExecuteStr(client, "HELP")){
  596.       fprintf(stderr, "IDL_RPCExecuteStr: Error executing string \n");
  597.       return 1;
  598.    }
  599.    return 0;
  600. }
  601. /***************************************************************************
  602.  * RPCGetArrayTest()
  603.  *
  604.  * Used to test the passing of Array data back and fourth from IDL
  605.  * to the server.
  606.  */
  607. int RPCGetArrayTest(CLIENT *pClient)
  608. {
  609.   IDL_VPTR  pVtmp;
  610.   UCHAR    *pByte;
  611.   int      *pInt;
  612.   IDL_LONG *pLong;
  613.   float    *pFloat;
  614.   double   *pDouble;
  615.   IDL_COMPLEX *pComplex;
  616.   IDL_DCOMPLEX *pDComplex;
  617.   IDL_STRING *pString;
  618.     
  619.   if(IDL_RPCExecuteStr(pClient, "VA_BYTE=bindgen(15)")){
  620.       fprintf(stderr,"Error executing Command String\n");
  621.       return 1;
  622.    }
  623.    pVtmp = IDL_RPCGetMainVariable(pClient, "VA_BYTE");
  624.    if(IDL_RPCGetVarType(pVtmp) != IDL_TYP_BYTE || !IDL_RPCVarIsArray(pVtmp) ||
  625.       IDL_RPCGetArrayNumElts(pVtmp) != 15){
  626.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting byte array\n");
  627.       return 1;
  628.    }
  629.    IDL_RPCDeltmp(pVtmp);
  630.  
  631.    if(IDL_RPCExecuteStr(pClient, "VA_INT=indgen(31)")){
  632.       fprintf(stderr,"Error executing command string\n");
  633.       return 1;
  634.    }
  635.    pVtmp = IDL_RPCGetMainVariable(pClient, "VA_INT");
  636.    if(IDL_RPCGetVarType(pVtmp) != IDL_TYP_INT || !IDL_RPCVarIsArray(pVtmp) ||
  637.       IDL_RPCGetArrayNumElts(pVtmp) != 31){
  638.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting int array\n");
  639.       return 1;
  640.    }
  641.    IDL_RPCDeltmp(pVtmp);
  642.  
  643.    if(IDL_RPCExecuteStr(pClient, "VA_LONG=lindgen(30)")){
  644.       fprintf(stderr,"Error executing command string\n");
  645.       return 1;
  646.    }
  647.    pVtmp = IDL_RPCGetMainVariable(pClient, "VA_LONG");
  648.    if(IDL_RPCGetVarType(pVtmp) != IDL_TYP_LONG || !IDL_RPCVarIsArray(pVtmp) ||
  649.       IDL_RPCGetArrayNumElts(pVtmp) != 30){
  650.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting long array\n");
  651.       return 1;
  652.    }
  653.    IDL_RPCDeltmp(pVtmp);
  654.  
  655.    if(IDL_RPCExecuteStr(pClient, "VA_FLOAT=findgen(31)")){
  656.       fprintf(stderr,"Error executing command string\n");
  657.       return 1;
  658.    }
  659.    pVtmp = IDL_RPCGetMainVariable(pClient, "VA_FLOAT");
  660.    if(IDL_RPCGetVarType(pVtmp) != IDL_TYP_FLOAT || !IDL_RPCVarIsArray(pVtmp) ||
  661.       IDL_RPCGetArrayNumElts(pVtmp) != 31){
  662.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting float array\n");
  663.       return 1;
  664.    }
  665.    IDL_RPCDeltmp(pVtmp);
  666.  
  667.    if(IDL_RPCExecuteStr(pClient, "VA_DOUBLE=dindgen(30)")){
  668.       fprintf(stderr,"Error executing command string\n");
  669.       return 1;
  670.    }
  671.    pVtmp = IDL_RPCGetMainVariable(pClient, "VA_DOUBLE");
  672.    if(IDL_RPCGetVarType(pVtmp) != IDL_TYP_DOUBLE || !IDL_RPCVarIsArray(pVtmp) ||
  673.       IDL_RPCGetArrayNumElts(pVtmp) != 30){
  674.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting double array\n");
  675.       return 1;
  676.    }
  677.    IDL_RPCDeltmp(pVtmp);
  678.  
  679.    if(IDL_RPCExecuteStr(pClient, "VA_COMPLEX=cindgen(21)")){
  680.       fprintf(stderr,"Error executing command string\n");
  681.       return 1;
  682.    }
  683.    pVtmp = IDL_RPCGetMainVariable(pClient, "VA_COMPLEX");
  684.    if(IDL_RPCGetVarType(pVtmp) != IDL_TYP_COMPLEX || !IDL_RPCVarIsArray(pVtmp) ||
  685.       IDL_RPCGetArrayNumElts(pVtmp) != 21){
  686.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting complex array\n");
  687.       return 1;
  688.    }
  689.    IDL_RPCDeltmp(pVtmp);
  690.  
  691.    if(IDL_RPCExecuteStr(pClient, "VA_DCOMPLEX=dcindgen(7)")){
  692.       fprintf(stderr,"Error executing command string\n");
  693.       return 1;
  694.    }
  695.    pVtmp = IDL_RPCGetMainVariable(pClient, "VA_DCOMPLEX");
  696.    if(IDL_RPCGetVarType(pVtmp) != IDL_TYP_DCOMPLEX || !IDL_RPCVarIsArray(pVtmp) ||
  697.       IDL_RPCGetArrayNumElts(pVtmp) != 7){
  698.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting dcomplex array\n");
  699.       return 1;
  700.    }
  701.    IDL_RPCDeltmp(pVtmp);
  702.  
  703.    if(IDL_RPCExecuteStr(pClient, "VA_STRING=sindgen(32)")){
  704.       fprintf(stderr,"Error executing command string\n");
  705.       return 1;
  706.    }
  707.    pVtmp = IDL_RPCGetMainVariable(pClient, "VA_STRING");
  708.    if(IDL_RPCGetVarType(pVtmp) != IDL_TYP_STRING || !IDL_RPCVarIsArray(pVtmp) ||
  709.       IDL_RPCGetArrayNumElts(pVtmp) != 32){
  710.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting string array\n");
  711.       return 1;
  712.    }
  713.    IDL_RPCDeltmp(pVtmp);
  714.    if(IDL_RPCExecuteStr(pClient, "HELP")){
  715.       fprintf(stderr, "IDL_RPCExecuteStr: Error executing help command\n");
  716.       return 1;
  717.    }
  718.    return 0;
  719. }
  720. /****************************************************************************
  721.  * RpcSetArray()
  722.  *
  723.  * Used to test the array setting ability of the routines.
  724.  */
  725. int RPCSetArrayTest(CLIENT *pClient)
  726. {
  727.  
  728.    IDL_VPTR  pVptr;
  729.    UCHAR    *pByte;
  730.    short    *pInt;
  731.    IDL_LONG *pLong;
  732.    float    *pFloat;
  733.    double   *pDouble;
  734.    IDL_COMPLEX *pComplex;
  735.    IDL_DCOMPLEX *pDComplex;
  736.    IDL_STRING *pString;
  737.  
  738.    IDL_LONG     l_dim1 = 100;
  739.    IDL_LONG     l_dim2[2] = {10,9}; 
  740.    int          i,j;
  741.  
  742. /*
  743.  * Start with Main Level. Send over an byte array
  744.  */
  745.    pByte = (UCHAR*)IDL_RPCMakeArray(IDL_TYP_BYTE, 1, &l_dim1, 
  746.                     IDL_BARR_INI_ZERO, &pVptr);
  747.    for(i=0;i<l_dim1;i++)
  748.      pByte[i]=(UCHAR)i;
  749.  
  750.    if(!IDL_RPCSetMainVariable(pClient, "SET_BYTE", pVptr)){
  751.      fprintf(stderr,"error setting output variable\n");
  752.      return 1;
  753.    }
  754.    IDL_RPCDeltmp(pVptr);
  755.    pVptr = IDL_RPCGetMainVariable(pClient, "SET_BYTE");
  756.    if(!pVptr){
  757.       fprintf(stderr, "IDL_RPCGetVariable: Error getting variable SET_BYTE.\n");
  758.       return 1;
  759.     }
  760. /*
  761.  * Does result look sane?
  762.  */
  763.    if(IDL_RPCGetVarType(pVptr) != IDL_TYP_BYTE || !IDL_RPCVarIsArray(pVptr) ||
  764.       IDL_RPCGetArrayNumElts(pVptr) != l_dim1){
  765.       fprintf(stderr, "Return Byte variable attributes wrong.\n");
  766.       return 1;
  767.    }
  768.    IDL_RPCDeltmp(pVptr);
  769.  
  770.    pInt = (short*)IDL_RPCMakeArray(IDL_TYP_INT, 1, &l_dim1, 
  771.                     IDL_BARR_INI_ZERO, &pVptr);
  772.    for(i=0;i<l_dim1;i++)
  773.       pInt[i]=(short)i;
  774.    if(!IDL_RPCSetMainVariable(pClient, "SET_INT", pVptr)){
  775.      fprintf(stderr, "error setting output variable\n");
  776.      return 1;
  777.    }
  778.    IDL_RPCDeltmp(pVptr);
  779.    pVptr = IDL_RPCGetMainVariable(pClient, "SET_INT");
  780.    if(!pVptr){
  781.       fprintf(stderr, "IDL_RPCGetVariable: Error getting variable SET_INT.\n");
  782.       return 1;
  783.     }
  784. /*
  785.  * Does result look sane?
  786.  */
  787.    if(IDL_RPCGetVarType(pVptr) != IDL_TYP_INT || !IDL_RPCVarIsArray(pVptr) ||
  788.       IDL_RPCGetArrayNumElts(pVptr) != l_dim1){
  789.       fprintf(stderr, "Return int variable attributes wrong.\n");
  790.       return 1;
  791.    }
  792.    IDL_RPCDeltmp(pVptr);
  793.  
  794.    pLong = (IDL_LONG*)IDL_RPCMakeArray(IDL_TYP_LONG, 2, l_dim2, 
  795.                     IDL_BARR_INI_ZERO, &pVptr);
  796.    if(!IDL_RPCSetMainVariable(pClient, "SET_LONG", pVptr)){
  797.      fprintf(stderr,"error setting output variable\n");
  798.      return 1;
  799.    }
  800.    IDL_RPCDeltmp(pVptr);
  801.    pVptr = IDL_RPCGetMainVariable(pClient, "SET_LONG");
  802.    if(!pVptr){
  803.       fprintf(stderr, "IDL_RPCGetVariable: Error getting variable SET_LONG.\n");
  804.       return 1;
  805.     }
  806. /*
  807.  * Does result look sane?
  808.  */
  809.    if(IDL_RPCGetVarType(pVptr) != IDL_TYP_LONG || !IDL_RPCVarIsArray(pVptr) ||
  810.       IDL_RPCGetArrayNumElts(pVptr) != l_dim2[0]*l_dim2[1]){
  811.       fprintf(stderr, "Return long variable attributes wrong.\n");
  812.       return 1;
  813.    }
  814.    IDL_RPCDeltmp(pVptr);
  815.  
  816.    pFloat = (float*)IDL_RPCMakeArray(IDL_TYP_FLOAT, 1, &l_dim1, 
  817.                     IDL_BARR_INI_ZERO, &pVptr);
  818.    for(i=0;i<l_dim1;i++)
  819.       pFloat[i]=(float)i;
  820.    if(!IDL_RPCSetMainVariable(pClient, "SET_FLOAT", pVptr)) {
  821.      fprintf(stderr, "error setting output variable\n");
  822.      return 1;
  823.    }
  824.    IDL_RPCDeltmp(pVptr);
  825.    pVptr = IDL_RPCGetMainVariable(pClient, "SET_FLOAT");
  826.    if(!pVptr){
  827.       fprintf(stderr, "IDL_RPCGetVariable: Error getting variable SET_FLOAT.\n");
  828.       return 1;
  829.     }
  830. /*
  831.  * Does result look sane?
  832.  */
  833.    if(IDL_RPCGetVarType(pVptr) != IDL_TYP_FLOAT || !IDL_RPCVarIsArray(pVptr) ||
  834.       IDL_RPCGetArrayNumElts(pVptr) != l_dim1){
  835.       fprintf(stderr, "Return float variable attributes wrong.\n");
  836.       return 1;
  837.    }
  838.    IDL_RPCDeltmp(pVptr);
  839. /*
  840.  * Now with the current program Level. Send over an byte array
  841.  */
  842.    pByte = (UCHAR*)IDL_RPCMakeArray(IDL_TYP_BYTE, 1, &l_dim1, 
  843.                     IDL_BARR_INI_ZERO, &pVptr);
  844.    for(i=0;i<l_dim1;i++)
  845.      pByte[i]=(UCHAR)i;
  846.  
  847.    if(!IDL_RPCSetVariable(pClient, "SET_BYTE", pVptr)){
  848.      fprintf(stderr,"error setting output variable\n");
  849.      return 1;
  850.    }
  851.    IDL_RPCDeltmp(pVptr);
  852.    pVptr = IDL_RPCGetVariable(pClient, "SET_BYTE");
  853.    if(!pVptr){
  854.       fprintf(stderr, "IDL_RPCGetVariable: Error getting variable SET_BYTE.\n");
  855.       return 1;
  856.     }
  857. /*
  858.  * Does result look sane?
  859.  */
  860.    if(IDL_RPCGetVarType(pVptr) != IDL_TYP_BYTE || !IDL_RPCVarIsArray(pVptr) ||
  861.       IDL_RPCGetArrayNumElts(pVptr) != l_dim1){
  862.       fprintf(stderr, "Return byte variable attributes wrong.\n");
  863.       return 1;
  864.    }
  865.    IDL_RPCDeltmp(pVptr);
  866.  
  867.    pInt = (short*)IDL_RPCMakeArray(IDL_TYP_INT, 1, &l_dim1, 
  868.                     IDL_BARR_INI_ZERO, &pVptr);
  869.    for(i=0;i<l_dim1;i++)
  870.       pInt[i]=(short)i;
  871.    if(!IDL_RPCSetVariable(pClient, "SET_INT", pVptr)){
  872.      fprintf(stderr, "error setting output variable\n");
  873.      return 1;
  874.    }
  875.    IDL_RPCDeltmp(pVptr);
  876.    pVptr = IDL_RPCGetVariable(pClient, "SET_INT");
  877.    if(!pVptr){
  878.       fprintf(stderr, "IDL_RPCGetVariable: Error getting variable SET_INT.\n");
  879.       return 1;
  880.     }
  881. /*
  882.  * Does result look sane?
  883.  */
  884.    if(IDL_RPCGetVarType(pVptr) != IDL_TYP_INT || !IDL_RPCVarIsArray(pVptr) ||
  885.       IDL_RPCGetArrayNumElts(pVptr) != l_dim1){
  886.       fprintf(stderr, "Return int variable attributes wrong.\n");
  887.       return 1;
  888.    }
  889.    IDL_RPCDeltmp(pVptr);
  890.  
  891.    pLong = (IDL_LONG*)IDL_RPCMakeArray(IDL_TYP_LONG, 2, l_dim2, 
  892.                     IDL_BARR_INI_ZERO, &pVptr);
  893.    if(!IDL_RPCSetVariable(pClient, "SET_LONG", pVptr)){
  894.      fprintf(stderr,"error setting output variable\n");
  895.      return 1;
  896.    }
  897.    IDL_RPCDeltmp(pVptr);
  898.    pVptr = IDL_RPCGetVariable(pClient, "SET_LONG");
  899.    if(!pVptr){
  900.       fprintf(stderr, "IDL_RPCGetVariable: Error getting variable SET_LONG.\n");
  901.       return 1;
  902.     }
  903. /*
  904.  * Does result look sane?
  905.  */
  906.    if(IDL_RPCGetVarType(pVptr) != IDL_TYP_LONG || !IDL_RPCVarIsArray(pVptr) ||
  907.       IDL_RPCGetArrayNumElts(pVptr) != l_dim2[0]*l_dim2[1]){
  908.       fprintf(stderr, "Return long variable attributes wrong.\n");
  909.       return 1;
  910.    }
  911.    IDL_RPCDeltmp(pVptr);
  912.  
  913.    pFloat = (float*)IDL_RPCMakeArray(IDL_TYP_FLOAT, 1, &l_dim1, 
  914.                     IDL_BARR_INI_ZERO, &pVptr);
  915.    for(i=0;i<l_dim1;i++)
  916.       pFloat[i]=(float)i;
  917.    if(!IDL_RPCSetVariable(pClient, "SET_FLOAT", pVptr)) {
  918.      fprintf(stderr, "error setting output variable\n");
  919.      return 1;
  920.    }
  921.    IDL_RPCDeltmp(pVptr);
  922.    pVptr = IDL_RPCGetVariable(pClient, "SET_FLOAT");
  923.    if(!pVptr){
  924.       fprintf(stderr, "IDL_RPCGetVariable: Error getting variable SET_FLOAT.\n");
  925.       return 1;
  926.     }
  927. /*
  928.  * Does result look sane?
  929.  */
  930.    if(IDL_RPCGetVarType(pVptr) != IDL_TYP_FLOAT || !IDL_RPCVarIsArray(pVptr) ||
  931.       IDL_RPCGetArrayNumElts(pVptr) != l_dim1){
  932.       fprintf(stderr, "Return float variable attributes wrong.\n");
  933.       return 1;
  934.    }
  935.    IDL_RPCDeltmp(pVptr);
  936.  
  937.    if(IDL_RPCExecuteStr(pClient, "HELP, SET_BYTE, SET_INT, SET_LONG, set_float")){
  938.       fprintf(stderr, "IDL_RPCExecuteStr: Error executing help command\n");
  939.       return 1;
  940.    }
  941.    return 0; 
  942. }
  943. /***************************************************************************
  944.  * RPCMemoryTest()
  945.  *
  946.  * Purpose:
  947.  *    This routine sends an array to the server repeatedly and 
  948.  *     checks for any memory leaks on the server side.
  949.  */
  950. int RPCMemoryTest(CLIENT *pClient)
  951. {
  952.    char     *pData;
  953.    IDL_VPTR     pVar, pVarMem;
  954.    long         lMem0;
  955.    int         i, iRet=0;            
  956.    IDL_LONG      lDim=100;
  957. /*
  958.  * Start by building an array variable
  959.  */
  960.    pData = IDL_RPCMakeArray(IDL_TYP_FLOAT, 1, &lDim, 
  961.                 IDL_BARR_INI_ZERO, &pVar);
  962.    if(!pData){
  963.       fprintf(stderr, "IDL_RPCMakeArray: Error allocating memory\n");
  964.       return 1;
  965.    }
  966. /* 
  967.  * Send the variable to the server so that it is initially set.
  968.  */
  969.    if(!IDL_RPCSetMainVariable(pClient, "F_MEM", pVar)){
  970.       fprintf(stderr, "IDL_RPCSetMainVariable: Error setting array\n");
  971.       IDL_RPCDeltmp(pVar);
  972.       return 1;
  973.    }
  974. /*
  975.  * Get the start memory value
  976.  */
  977.    if(IDL_RPCExecuteStr(pClient, "mem0=(memory())(0)")){
  978.       fprintf(stderr, "IDL_RPCExecuteStr: Error setting memory variable\n");
  979.       IDL_RPCDeltmp(pVar);
  980.       return 1;
  981.    }
  982.    pVarMem = IDL_RPCGetMainVariable(pClient, "MEM0");
  983.    if(!pVarMem){
  984.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting mem0\n");
  985.       IDL_RPCDeltmp(pVar);
  986.       return 1;
  987.    }
  988.    lMem0 = IDL_RPCGetVarLong(pVarMem);
  989.    IDL_RPCDeltmp(pVarMem);
  990.    (void)IDL_RPCExecuteStr(pClient, "help, /mem");
  991. /*
  992.  * Now to loop thru and set the variable on the server side.
  993.  */
  994.    for(i=0;i<1000; i++){
  995.       if(!IDL_RPCSetMainVariable(pClient, "F_MEM", pVar)){
  996.      fprintf(stderr, "IDL_RPCSetMainVariable: Error setting F_MEM\n");
  997.      IDL_RPCDeltmp(pVar);
  998.      return 1;
  999.       }
  1000.       if( !(i %10)){        /* A "working" indicator */
  1001.         fprintf(stdout,".");
  1002.         fflush(stdout);
  1003.       }
  1004.    } 
  1005.    (void)IDL_RPCExecuteStr(pClient, "help, /mem");
  1006. /*
  1007.  * Now get the resulting memory level.
  1008.  */
  1009.    if(IDL_RPCExecuteStr(pClient, "mem0=(memory())(0)")){
  1010.       fprintf(stderr, "IDL_RPCExecuteStr: Error setting memory variable\n");
  1011.       IDL_RPCDeltmp(pVar);
  1012.       return 1;
  1013.    }
  1014.    pVarMem = IDL_RPCGetMainVariable(pClient, "MEM0");
  1015.    if(!pVarMem){
  1016.       fprintf(stderr, "IDL_RPCGetMainVariable: Error getting mem0\n");
  1017.       IDL_RPCDeltmp(pVar);
  1018.       return 1;
  1019.    }
  1020.    if(lMem0 != IDL_RPCGetVarLong(pVarMem)){
  1021.       fprintf(stderr, "Memory Leak detected on the server.\n");
  1022.       fprintf(stderr, "\tInitial %d\t Final %d\n", lMem0, 
  1023.           IDL_RPCGetVarLong(pVarMem));
  1024.       iRet = 1;
  1025.    }
  1026.    IDL_RPCDeltmp(pVarMem);
  1027.    IDL_RPCDeltmp(pVar);
  1028.    return iRet;
  1029. }
  1030. /***************************************************************************
  1031.  * RPCExeTest()
  1032.  *
  1033.  * Used to test the execute command string functionality.
  1034.  */
  1035. int RPCExeTest( CLIENT *pClient)
  1036. {
  1037.  
  1038.    int     iResult;
  1039.    char    sBuffer[512];
  1040.  
  1041. /*
  1042.  * Start by setting up command line trapping
  1043.  */
  1044.    if(!IDL_RPCOutputCapture(pClient, 100)){
  1045.       fprintf(stderr, "IDL_RPCOutputCapture: Error setting up buffer\n");
  1046.       return 1;
  1047.    }
  1048. /*
  1049.  * Start up a command processing loop
  1050.  */
  1051.    fprintf(stdout, "\nEnter IDL Commands,  ^D or a null line to exit\n\n");
  1052.    for(;;){
  1053.       printf("RMTIDL> ");
  1054.       sBuffer[0] = '\0';
  1055.       gets(sBuffer);
  1056.       if(sBuffer[0] == (char)NULL)
  1057.          break;   /* user whats to exit */
  1058.       iResult=IDL_RPCExecuteStr( pClient, sBuffer);
  1059.       RPCFlushOutput(pClient);
  1060.       
  1061.    /*
  1062.     * Now flush the output buffer
  1063.     */
  1064.    }
  1065.    printf("\n");
  1066.    if(!IDL_RPCOutputCapture(pClient, 0)){
  1067.       fprintf(stderr, "IDL_RPCOutputCapture: Error disabling output capture.\n");
  1068.       return 1;
  1069.    }
  1070.    return 0;
  1071. }
  1072. /***************************************************************************
  1073.  * RpcFlushOutput()
  1074.  *
  1075.  * Test routine that empties out the output queue on the server
  1076.  */
  1077. void RPCFlushOutput(CLIENT *pClient)
  1078. {
  1079.    IDL_RPC_LINE_S sLine;
  1080.    char           outbuffer[IDL_RPC_MAX_STRLEN];
  1081.  
  1082.    sLine.buf = outbuffer;
  1083.  
  1084.    while(IDL_RPCOutputGetStr(pClient, &sLine, 0)){
  1085.       printf("%s%c", sLine.buf, (sLine.flags & IDL_TOUT_F_NLPOST ?
  1086.                      '\n' : '\0'));
  1087.    } /* thats it */
  1088.  }
  1089.  
  1090.  
  1091.  
  1092.